package chixing.day04;

public class Person {
    private String name;
    private int age;
    private String sex;
    private boolean isMarried;

    public void setName(String name)
    {
    	this.name = name;
    }
    public String getName()
    {
    	return this.name;
    }
    public void setAge(int age)
    {
    	this.age = age;
    }
    public int getAge()
    {
    	return this.age;
    }
    public void setSex(String sex)
    {
    	this.sex = sex;
    }
    public String getSex()
    {
    	return this.sex;
    }
    public void setIsMarried(boolean isMarried)
    {
    	this.isMarried = isMarried;
    }
    public boolean getIsMarried()
    {
    	return this.isMarried;
    }
    public static boolean isCanMarry(Person person1, Person person2) {
        if (person1.getIsMarried() || person2.getIsMarried()) {
            return false;
        }
        if (person1.getSex().equals(person2.getSex())) {
            return false;
        }
        if((((person1.getSex().equals("男")&&person1.getAge()>=24)&&(person2.getSex().equals("女")&&person2.getAge()>=22))||
                (((person1.getSex().equals("女")&&person1.getAge()>=22))&&((person2.getSex().equals("男")&&person2.getAge()>=24)))))
        return true;
        return false;
    }
}
